window.onload = function () {
    document.getElementById("technological-backlog").className = "add_class";
    document.getElementById("technological").className = "add-nav-active";
    document.getElementById("wangEditor").className = "editor-none";
};


// 控制富文本是否显示
function wangEditor_show() {
    var wangEditor = document.getElementById("wangEditor");
    if (wangEditor.className === "editor-none"){
        wangEditor.className = "editor-block";
    }else {
        wangEditor.className = "editor-none";
    }
}


// 审批
function examine(status) {
    var load_href = window.location.href;
    document.getElementById("loading").style.display = "inline-block";
    var editor_html = editor.txt.html().replaceAll("&", "%26");                // 富文本内容
    var application_id = window.location.href.split("flow_id=")[1];
    var xhr = new XMLHttpRequest();
    var local_host = window.location.host;          // 获取当前IP
    xhr.open('post', "/technological/ParseFlow", true);
    xhr.setRequestHeader('content-type', 'application/x-www-form-urlencoded');
    var sent_str = "status="+String(status)+"&approval_opinion="+String(editor_html)+"&application_id="+String(application_id);
    if (load_href.indexOf("trust") !== -1){
        var trustId = load_href.split("trust=")[1].split("&")[0];
        sent_str = "status="+String(status)+"&approval_opinion="+String(editor_html)+"&application_id="+String(application_id)+"&trust="+String(trustId);
    }
    xhr.send(sent_str);
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            if (xhr.status === 200) {
                document.getElementById("loading").style.display = "inline-block";
                document.getElementById("loading").style.display = "none";
                var JsonDate = JSON.parse(xhr.responseText);
                alert(JsonDate['message'])
            }
        }
    };
}
